#!/bin/bash
set -e
set -u
#
#set -x
#trap read debug

TestName="$(basename "$(pwd)")"

export TestName
export estat

#shellcheck source=../environment.in
. ./environment
#shellcheck source=../scripts/functions
. "${rscripts}"/functions
#shellcheck source=../scripts/reload_test_functions
. "${rscripts}"/reload_test_functions


export temporary_director_config_file="$config_directory_dir_additional_test_config/another_director.conf"
export bconsole_command_file="$tmp/bconsole_reload_command"
console_logfile="$tmp/console.log"

export director_debug_level=""
#director_debug_level="-d 200"


############################################
start_test
############################################

#be sure no director is started
stop_director

#cleanup possible leftover from last run
${rscripts}/cleanup
remove_console_logfile

${rscripts}/setup
start_director

#reload modified config
add_duplicate_dir_to_config
test_reload_will_not_crash_director
find_error_string_in_console_log 'Fatal error: Only one Director resource permitted'

stop_director

############################################
end_test
############################################

